var imgs;
function subslide2(i,n)
{
	$("#photo").slideToggle("slow");
	setTimeout("slideshow("+i+","+n+")", 1000);
}

function subslide(i,n)
{
	$("#photo").slideToggle("slow");
	setTimeout("subslide2("+i+","+n+")", 3000);
}
function init(id)
{
	imgs=document.getElementById(id).getElementsByTagName("img");
	slideshow(1,imgs.length);
}
function slideshow(i,n)
{
	var photo = document.getElementById("photo");
	var leftPanel = document.getElementById("leftPanel");
	photo.src = imgs[i-1].src;
	photo.alt = imgs[i-1].src;
	document.getElementById("a").href = imgs[i-1].src;
	photo.style.width = leftPanel.offsetWidth + "px";

	if (leftPanel.offsetWidth > photo.offsetWidth)
	{
		photo.style.width = photo.offsetWidth - (leftPanel.offsetWidth - photo.offsetWidth) + "px";
	}

	if ( i >= n )
		i = 1;
	else
		i ++;
    setTimeout("slideshow("+i+","+n+")", 2000);
	//setTimeout("subslide("+i+","+n+")", 1);
}
